jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};  

function seed(o){
var results = document.getElementById('results');
    results.innerHTML = o.result;
  }
  function doSearch(){
	var results = document.getElementById('results');
    results.innerHTML = '<div class="yui-gb">\
      <div class="yui-u first" id="google">\
      <h2>Google loading &hellip;</h2></div>\
      <div class="yui-u" id="yahoo"><h2>Yahoo loading &hellip;</h2></div>\
      <div class="yui-u" id="bing"><h2>Bing loading &hellip;</h2></div>\
    </div>';
    var query = document.getElementById('search').value;

$.get('collector/process/search/'+query+'/json/false/research/true', function(data) {
  results.innerHTML = data;
});

	return false;
  }


	function upfont(){
		curSize = parseInt($('#content').css("font-size"));
		newSize = curSize + 1;
		if (newSize <= 18) {
			$('#content').css('font-size', newSize);
		} 
		if (newSize > 10) {
			$("#fontcontroller .smallFont").removeClass("sdisabled");
		}
		if (newSize >= 18) {
			$("#fontcontroller .largeFont").addClass("ldisabled");
		}
		updatefontCookie("#content", newSize);
	}

	function defaultf(){
		$('#content').css('font-size', 12);
		$("#fontcontroller .smallFont").removeClass("sdisabled");
		$("#fontcontroller .largeFont").removeClass("ldisabled");
		updatefontCookie("#content", 12);
	}

	function downfont(){ 
		curSize = parseInt($("#content").css("font-size"));
		newSize = curSize - 1;
		if (newSize >= 10) {
			$("#content").css('font-size', newSize);
		} 
		if (newSize <= 10) {
			$("#fontcontroller .smallFont").addClass("sdisabled");
		}
		if (newSize < 18) {
			$("#fontcontroller .largeFont").removeClass("ldisabled");
		}
		updatefontCookie("#content", newSize); //sets the cookie 
		
	}


	function updatefontCookie(target, size) {
		if ($.cookie != undefined) { //If cookie plugin available, set a cookie
			var cookie = target.replace(/[#. ]/g,'');
			$.cookie(cookie, size);
		} 
	}

	if ($.cookie != undefined) {
		var cookie = "#content".replace(/[#. ]/g,'');
		var value = $.cookie(cookie);
		if (value !=null) {
			$("#content").css('font-size', parseInt(value));
		}
	}

$(function(){
	$("#sidebar").hover(
		 function()
		 {
		  $("#sidebar").animate({
			    opacity: "1"
			  });
		 },
		 function()
		 {
		  $("#sidebar").animate({
			    opacity: "0.4"
			  });
		 }
        );

});
 


